﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RepairList.aspx.cs" Inherits="MxWeiXinPF.Web.weixin.jiaoshuifei.RepairList" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

    <link href="css/weui.min.css?v=2" rel="stylesheet" />
    <link href="css/jquery-weui.min.css" rel="stylesheet" />
    <link href="css/demos.css" rel="stylesheet" />
    <title>报修列表</title>
     <style>
        .weui-cells {
            margin-top: 0px;
        }
    </style>
</head>
<body ontouchstart>
 
    <div class="weui-cells">
        <div class="weui-cell weui-cell_select weui-cell_select-after">
            <div class="weui-cell__hd">
                <label for="" class="weui-label">类型</label>
            </div>
            <div class="weui-cell__bd">
                <select class="weui-select" name="select2" id="fixType">
                    <option selected="" value="报修">报修</option>
                    <option value="报漏">报漏</option>
                </select>
            </div>
        </div>

    </div>

    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <label class="weui-label">联系人</label>
            </div>
            <div class="weui-cell__bd">
                <input class="weui-input" id="username" placeholder="联系人" />
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <label class="weui-label">电话</label>
            </div>
            <div class="weui-cell__bd">
                <input class="weui-input" placeholder="请输入电话" id="phone" />
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <label class="weui-label">地址</label>
            </div>
            <div class="weui-cell__bd">
                <input class="weui-input" placeholder="请输入地址" id="address" />
            </div>
        </div>
    </div>
    <div class="weui-cells__title">情况说明</div>
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__bd ">
                <textarea class="weui-textarea" placeholder="请输入情况说明" id="remark" rows="3"></textarea>

            </div>
        </div>
    </div>


    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__bd">
                <div class="weui-uploader">
                    <div class="weui-uploader__hd">
                        <p class="weui-uploader__title">图片上传</p>
                         
                    </div>
                    <div class="weui-uploader__bd">
                        <ul class="weui-uploader__files" id="uploaderFiles">
                            <li class="weui-uploader__file" style="background-image: url(/images/noneimg.jpg)" id="uploadImg"></li>

                        </ul>
                        <div class="weui-uploader__input-box">
                            <input id="uploaderInput" class="weui-uploader__input" type="file" accept="image/jpg,image/jpeg,image/png,image/gif" multiple="" onchange="fileUpload()">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <input type="hidden" id="imgFile" />

     <div class='demos-content-padded'>

        <a class="weui-btn weui-btn_primary" href="javascript:" id="showTooltips" onclick="bind()">提交</a>
    </div> 


    <%if (data != null && data.Tables.Count > 0 && data.Tables[0].Rows.Count > 0)
        {
            foreach (System.Data.DataRow item in data.Tables[0].Rows)
            {%>
     <div class="weui-cells">
        <a class="weui-cell weui-cell_access" href="javascript:;">
            <div class="weui-cell__bd">
                <p><%=item["bx_type"]%></p>
            </div>
            <div class="weui-cell__ft"><%= item["contact_tel"]%></div>
        </a>

    </div>
    <div class="weui-form-preview" style="display:none">
        <div class="weui-form-preview__bd">
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">报修时间</label>
                <span class="weui-form-preview__value"><%=item["create_time"]%></span>
            </div>
       
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">联系人</label>
                <span class="weui-form-preview__value"><%=item["contact_person"]%></span>
            </div>
        
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">电话</label>
                <span class="weui-form-preview__value"><%=item["contact_tel"]%></span>
            </div>
      
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">类型</label>
                <span class="weui-form-preview__value"><%=item["bx_type"]%></span>
            </div>
       
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">说明</label>
                <span class="weui-form-preview__value"><%=item["bx_content"]%></span>
            </div>
      
            <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">照片</label>
                <span class="weui-form-preview__value">
                    <img  style="max-height:100px;max-width:100px;"   src="<%=item["bx_pic"] %>" /></span>
            </div>
             <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">处理状态</label>
                <span class="weui-form-preview__value"><%=item["has_repair"].ToString().ToLower()=="true"?"已处理":"待处理" %></span>
            </div>
          <%--  <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">处理时间</label>
                <span class="weui-form-preview__value"><%=item["repair_time"]%></span>
            </div>--%>
        </div>
    </div>
    <%
            }
        } %>

    <div style="height:20px;">&nbsp;</div>
</body>
    <script src="js/zepto.min.js"></script>
        <script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="js/jquery-weui.js"></script>

    <script src="js/helper_min.js"></script>
    <script src="js/main.js"></script>
    <script>

        $(function () {
            $(".weui-cells").click(function () {
                $(this).next(".weui-form-preview").toggle();
            })
        })
    </script>


    <script>
        //绑定用户号
        function bind() {

            var fixType = $("#fixType").val();
            var username = $("#username").val();
            var phone = $("#phone").val();
            var address = $("#address").val();
            var remark = $("#remark").val();

            if (fixType == null || fixType == "") {

                $.toptip('请选择报修类型');

                retturn;
            }
            if (username == null || username == "") {
                $.toptip('请输入联系人');

                retturn;
            }
            if (phone == null || phone == "") {
                $.toptip('请输入电话');

                retturn;
            }
            if (address == null || address == "") {

                $.toptip('请输入地址');
                retturn;
            }
            //验证通过
            $.ajax({
                type: "post",
                url: "jsf_bindOne.ashx",
                data: { fixType: fixType, username: username, phone: phone, address: address, remark: remark, actionType: "fixApply", wid: '<%=wid%>', imgFile: $("#imgFile").val(), openid: '<%=openid%>' },
                beforeSend: function () {

                    $.showLoading();
                },
                success: function (data) {
                    if (data.succuss == 1) {
                        $.hideLoading();
                        $.alert("提交成功，请等待我们处理。", function () {
                            //点击确认后的回调函数
                            window.location.href = "index.aspx?wid=<%=wid%>";
                        });
                    }
                    else {
                        $.hideLoading();
                        $.toptip(data.msg);

                    }
                }
            });
        }

        //上传图片
        function fileUpload() {


            window.ajax2("../../tools/upload_ajax.ashx", {
                type: "POST",
                async: true,
                data: { Filedata: $("#uploaderInput").get(0).files[0] },
                timeout: 10000 * 6,
                callback: function (data) {
                    if (data.status == 1) {


                        $("#uploadImg").css("background-image", "url(" + data.path + ")");
                        $("#imgFile").val(data.path);

                        $.toptip(data.msg, 'success');
                    }
                    else {
                        $.toptip(data.msg);
                    }
                },
            });


        }

    </script>
</html>
